//
// Created by tan on 22-8-25.
//

#include "basedata.h"
#include "DataCtrl.h"

SGPoints createSGPoints(const DataCtrl &dataCtrl) {
    SGPoints sgPoints;
    sgPoints.n = (int) dataCtrl.allPoints.size();
    sgPoints.points = dataCtrl.allPoints;
    return sgPoints;
}


SGLines::SGLines(const DataCtrl &dataCtrl) {
    auto allLines = dataCtrl.allLines;
    int ni = 0;

    for (auto &line: allLines) {
        if (ni < line.lineNo) {
            ni = line.lineNo;
        }
    }

    GLine *pGLines[ni + 1];

    this->n = (int) allLines.size();
    this->maxIndex = ni;

    for (auto &line: allLines) {
        pGLines[line.lineNo] = &line;
    }

    cout << pGLines[1145]->allPoints.size() << endl;
    this->nIdx = *pGLines;
//    this->nIdx = *pGLines;
}
